home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18150 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.5 KB

  1. Path: heydan.tiac.net!user
  2. From: heydan@tiac.net (Dan Winkler)
  3. Newsgroups: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
  4. Subject: Telescript Networking (was Re: Advice to Java proponents)
  5. Date: Thu, 18 Apr 1996 22:26:14 -0400
  6. Organization: The Internet Access Company
  7. Message-ID: <heydan-1804962226140001@heydan.tiac.net>
  8. References: <315BFB16.B74@isg.de> <4jgv6t$hon@kadath.zeitgeist.net> <4k3cdo$np5@taurus.adnc.com> <DpG1s1.GC9@research.att.com> <4k71f5$ot5@news2.ios.com> <31684F33.2528@ibm.net> <denatale-0804960926250001@grail1213.nando.net> <316DA213.767B@vdc.smos.com> <316E2AD0.17C3@concentric.net>
  9. NNTP-Posting-Host: heydan.tiac.net
  10. X-Newsreader: Yet Another NewsWatcher 2.1.8
  11.  
  12. > Proud of the networking functions in the Java library, are we?
  13. > VisualWorks Smalltalk has had such for quite a while now. 
  14. > ...smalltalk example deleted...
  15. > I wonder how easy this stuff is in Telescript?  
  16.  
  17. Alan, I forwarded your question about Telescript to General Magic and
  18. got the following reply from Rory Ward. --Dan
  19.  
  20.  
  21. Here is a similar example to the Smalltalk example given.
  22.  
  23. Since Telescript is all about distributed programming, all the network
  24. infrastructure is built directly into language. Telescript provides a high
  25. level of network abstraction, so you don't need to worry about sockets or
  26. flattening data or what byte means what. Telescript allows objects and code to
  27. travel around the network. Agents are a type of Telescript process that can
  28. 'go' around the network. Places are a different type of Telescript process
  29. that host agents. Effectively, agents are clients and places are servers.
  30. Programmers subclass agents and places as they see fit. When an agents go, its
  31. complete state and optionally its class is transmitted across the network on a
  32. secure, authenticated connection. And I don't need to worry about the remote
  33. engine coming down, because Telescript objects (including processes) are
  34. automatically persisted. When the engine is brought back up, I'll continue
  35. from where I stopped.
  36.  
  37. An agent that goes to a remote host to get the time:
  38.  
  39. // TimeAgent is a subclass of Agent. Agent's can roam the network. Cool
  40. TimeAgent: class(Agent) = (
  41. public
  42.   // The host and port of the destination Telescript Engine I am going to
  43.   host: String;  port: Integer;
  44.  
  45.   // initialize my host and port and escalate to my superclass
  46.   initialize:
  47.     op(host: copied String; port: Integer;
  48.        Permit; Permit|Nil; Integer|Nil; OctetString|Nil) = { ^; };
  49.  
  50.   // Specialize my live method. This is may main(). Every Telescript
  51.   // process has its own thread of execution
  52.   live:
  53.     sponsored op(ex: Exception|Nil) =
  54.   {
  55.     // Create the ticket to where I'm going. The Way says I should
  56.     // use TCP to travel to my destination
  57.     // The nils mean I don't care what place I end up in. 
  58.     // The destination engine will choose what place I will end up 
  59.     // (at the discretion of the place)
  60.     ticket:= Ticket(nil, nil, nil, nil, Way(nil, TCPMeans(port, host)));
  61.  
  62.     // Make sure we can catch an exception while travelling
  63.     try {
  64.  
  65.       // Go to the remote site. It's as simple as one operation.
  66.       // Everything (properties, class, run stack) gets packed up
  67.       // and I am transferred through an authenticated connection
  68.       // to my destination
  69.       *.go(ticket);
  70.  
  71.       // I am now at the remote site. What time is it ??
  72.       Time().dump();
  73.     } 
  74.     // If the remote site isn't available, I get a TripException
  75.     catch TripException { "Couldn't get there".dump(); };
  76.   };
  77. );
  78.  
  79. /Rory
  80. Rory Ward
  81. General Magic Inc
  82. rory_ward@genmagic.com
  83.